<template>
  <header class="header">
        <h1>小黑记事本</h1>
        <input v-model="toduname" placeholder="请输入任务" class="new-todo" />
        <button class="add" @click="post">添加任务</button>
      </header>
</template>

<script>
  export default {
    props: ['list'],
    data() { 
      return {
        toduname:'' // 输入框的值
       }
    },
    methods: {
      post() {
        this.$emit('add' , this.toduname)
        this.toduname = '' // 清空输入框
       }
  }
}
</script>

<style lang="scss" scoped>

</style>